#! /usr/bin/env python
# -*- coding: utf-8 -*-

from .util import iterable


class Cluster(object):

    __slots__ = 'eles'

    def __init__(self, eles):
        if iterable(eles):
            self.eles = eles
        else
            self.eles = [eles]

        self.ele_class = type(self.eles[0])

    def __sub__(self, ele):
        # 计算一个元素和当前cluster距离
        average = self.average()
        return self.average - ele

    def average(self):
        # 可以缓存, 优化
        average = self.ele_class.average(self.eles)

    def add(self, ele):
        self.append(ele)

    def remove(self, ele, all=False):
        # ele 要实现 ==
        pass
